﻿using System;
using WI.CandidateManager.Business.Objects.Helper;
using WI.CandidateManager.Common.Data.Entities;

namespace WI.CandidateManager.Business.Objects
{
    /// <summary>
    /// UserBase business logic.
    /// </summary>
    public abstract class UserBaseBO : EntityBaseBO
    {
        /// <summary>
        /// Prepares user to be put into DB.
        /// </summary>
        /// <param name="user">
        /// The user.
        /// </param>
        /// <returns>
        /// The WI.CandidateManager.Common.Data.Entities.UserBase.
        /// </returns>
        protected UserBase PrepareUser(UserBase user)
        {
            user.Password = new CryptoHelper(user.Password.ToCharArray()).HashedPassword;
            user.RegisterDate = DateTime.Now;

            return user;
        }
    }
}
